| Conditions | 2 |
| Paths | 2 |
| Total Lines | 39 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | (function () { |
||
| 2 | $(document).ready(function () { |
||
| 3 | |||
| 4 | // Don't do anything if this isn't a Edit Counter page. |
||
| 5 | if ($("body.ec").length === 0) { |
||
| 6 | return; |
||
| 7 | } |
||
| 8 | |||
| 9 | // Set up charts. |
||
| 10 | $(".chart-wrapper").each(function () { |
||
| 11 | var chartType = $(this).data("chart-type"); |
||
| 12 | if ( chartType === undefined ) { |
||
| 13 | return false; |
||
| 14 | } |
||
| 15 | var data = $(this).data("chart-data"); |
||
| 16 | var labels = $(this).data("chart-labels"); |
||
| 17 | var $ctx = $("canvas", $(this)); |
||
| 18 | new Chart($ctx, { |
||
| 19 | type: chartType, |
||
| 20 | data: { |
||
| 21 | labels: labels, |
||
| 22 | datasets: [ { data: data } ] |
||
| 23 | } |
||
| 24 | }); |
||
| 25 | }); |
||
| 26 | |||
| 27 | // Load recent global edits' HTML via Ajax, to not slow down the initial page load. |
||
| 28 | var $latestGlobalContainer = $("#latestglobal-container"); |
||
| 29 | var url = xtBaseUrl + 'ec-latestglobal/' |
||
| 30 | + $latestGlobalContainer.data("project") + '/' |
||
| 31 | + $latestGlobalContainer.data("username") + '?htmlonly=yes'; |
||
| 32 | $.ajax({ |
||
| 33 | url: url, |
||
| 34 | timeout: 30000 |
||
| 35 | }).done(function (data) { |
||
| 36 | $latestGlobalContainer.replaceWith(data); |
||
| 37 | }).fail(function (data) { |
||
| 38 | }); |
||
| 39 | |||
| 40 | }); |
||
| 41 | } )(); |
||
| 42 |